package com.sh15tech.mp.weixin.thread;

import java.util.Calendar;

import com.sh15tech.mp.weixin.SysConfig;
import com.sh15tech.mp.weixin.common.HttpHelper;
import com.sh15tech.mp.weixin.common.Tool;
import com.sh15tech.mp.weixin.modal.WxToken;
import com.sh15tech.mp.weixin.scan.WxSender;


public class WxTokenThread implements Runnable {

	@Override
	public void run() {
		
		while(true){
			Calendar calendar = Calendar.getInstance();
			if (SysConfig.token == null || SysConfig.expireTime.before(calendar.getTime())) {
				HttpHelper.refreshToken();
			}

			try {
				Thread.sleep(9000000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			
		}
		
	}
}
